
public class Triunghi implements Poligon{
    private Punct a;
    private Punct b;
    private Punct c;
    public Triunghi(Punct a,Punct b,Punct c)
    {
        this.a=a;
        this.b=b;
        this.c=c;
    }
    public double perimetru()
    //calcul perimetrului delegat clasei Punct
    {
        return a.distanta(b)+b.distanta(c)+c.distanta(a);
    }
    public double arie()
    //analog dar pt arie se aplica formula lui Heron
    {
        double semiperimetru=this.perimetru()/2;
        return Math.sqrt(semiperimetru*(semiperimetru-a.distanta(b))*(semiperimetru-b.distanta(c))*(semiperimetru-c.distanta(a)));
        }
    public String toString()
    {
        return "Laturile triungiului sunt formate din punctele: "+a+" "+b+" "+c;
    }


}
